﻿using Furion.ConfigurableOptions;

namespace ZeroAdmin.Core;

/// <summary>
/// 数据库配置
/// </summary>
public class DatabaseConfig : IConfigurableOptions
{
    /// <summary>
    /// 默认数据库类型
    /// </summary>
    public string DefaultDbType { get; set; } = "";

    /// <summary>
    /// 默认数据库连接字符串
    /// </summary>
    public string DefaultDbString { get; set; } = "";
}

/// <summary>
/// 数据库常量
/// </summary>
public class DatabaseConst
{
    /// <summary>
    /// 创建时间
    /// </summary>
    public const string CreateTime = "CreateTime";

    /// <summary>
    /// 更新时间
    /// </summary>
    public const string UpdateTime = "UpdateTime";
}

/// <summary>
/// 页面输入
/// </summary>
public class PageInputBase
{
    /// <summary>
    /// 当前页码
    /// </summary>
    public int PageIndex { get; set; } = 1;

    /// <summary>
    /// 页码容量
    /// </summary>
    public int PageSize { get; set; } = 20;
}

/// <summary>
/// 分页泛型集合
/// </summary>
/// <typeparam name="TEntity"></typeparam>
public class PageListBase<TEntity>
{
    /// <summary>
    /// 页码
    /// </summary>
    public int PageIndex { get; set; }

    /// <summary>
    /// 页容量
    /// </summary>
    public int PageSize { get; set; }

    /// <summary>
    /// 总条数
    /// </summary>
    public int TotalCount { get; set; }

    /// <summary>
    /// 总页数
    /// </summary>
    public int TotalPages { get; set; }

    /// <summary>
    /// 当前页集合
    /// </summary>
    public List<TEntity> Items { get; set; } = new List<TEntity>();

    /// <summary>
    /// 是否有上一页
    /// </summary>
    public bool HasPrevPages { get; set; }

    /// <summary>
    /// 是否有下一页
    /// </summary>
    public bool HasNextPages { get; set; }
}